<template>
	<view class="share-index">
		<view class="top-content-style">
			<view class="top-content">
				<view class="top">
					<view class="money-title">累积分红</view>
					<view class="money"><text class="symbol">￥ </text>{{ money_one }}</view>
				</view>
				<view class="bottom">
					<view class="left">
						<view class="money-title">已释放分红</view>
						<view class="money"><text class="symbol">￥</text>{{ money_two }}</view>
					</view>
					<view class="line"></view>
					<view class="right">
						<view class="money-title">待释放分红</view>
						<view class="money"><text class="symbol">￥</text>{{ money_three }}</view>
					</view>
					<!-- <view class="money-order-content">
						<view class="money-order">
							<view class="title">订金佣金</view>
							<view class="money-two"><text class="symbol">￥ </text>{{ money_three }}</view>
						</view>
					</view> -->
				</view>
			</view>
		</view>
		<view class="button-group">
			<view class="button" @click="navigateOrder">
				<view class="left">
					<image class="img" src="/static/images/mine/credit_detail.png"></image>
					<view class="content-text">
						<view class="time-count-style">
							<view class="time-title">分销明细</view>
						</view>
					</view>
				</view>
				<view class="right">
					<image class="in" src="/static/images/common/in.png"></image>
				</view>
			</view>
			<u-gap height="1" bgColor="#CDCDCD"></u-gap>
		</view>
	</view>
</template>

<script>
	import Fn from '@/common/public.js';
	import {
		reward
	} from '@/common/api.js';
	export default {
		data() {
			return {
				money_one: '0', // 累积佣金
				money_two: '0', // 已释放分红
				money_three: '0', // 未释放分红
				extract_money: '0', // 可提现佣金
				schedule: '无', // 提现进度
			};
		},
		onLoad() {

		},
		onShow() {
			this.getReward(); // 每次进入重新获取分享奖励
		},
		methods: {

			/* 获取分享奖励信息 */
			getReward() {
				const that = this;
				reward().then((res) => {
					if (res.status === 1) {
						const result = res.data;
						console.log(result);
						if (result != '') {
							that.money_one = Fn.checkDigit({
								number: result.weightMoney,
								len: 1,
								max: 100000000,
								min: -1
							});
							that.money_two = Fn.checkDigit({
								number: result.released,
								len: 1,
								max: 100000000,
								min: -1
							});
							that.money_three = Fn.checkDigit({
								number: result.toReleased,
								len: 1,
								max: 100000000,
								min: -1
							});
							// that.money_three = Fn.checkDigit({
							// 	number: result.orderMoney,
							// 	len: 4,
							// 	max: 100000000,
							// 	min: -1
							// });
							// that.extract_money = Fn.checkDigit({
							// 	number: result.drawMoney,
							// 	len: 4,
							// 	max: 100000000,
							// 	min: -1
							// });
						};
					} else {
						Fn.Toast(res.msg, 3, 1000);
					}
				});
			},

			/* 跳转至好友佣金详情页面 */
			navigateFriend() {
				uni.navigateTo({
					url: '/pages/share/friendBrokerage/friendBrokerage',
				});
			},

			/* 跳转至订单佣金详情页面 */
			navigateOrder() {
				uni.navigateTo({
					url: '/pages/share/orderBrokerageDetail/orderBrokerageDetail',
				});
			},

			/* 跳转至提现页面 */
			navigateExtract() {
				uni.navigateTo({
					url: '/pages/share/extract/extract',
				})
			},

			/* 跳转至我的团队页面 */
			navigateTeam() {
				uni.navigateTo({
					url: '/pages/share/team/team'
				})
			}
		}
	}
</script>

<style lang="scss">
	@import "@/static/css/share.scss";
</style>
